﻿<html>

	<head>
		<title>用户管理</title>
		<meta charset="utf-8">
		<meta name="viewport" content="maximum-scale=1.0,minimum-scale=1.0,user-scalable=0,width=device-width,initial-scale=1.0" />
		<meta name="format-detection" content="telephone=no,email=no,date=no,address=no">

		<link href="../../css/skin/default/style.css" rel="stylesheet" type="text/css" />
		<link rel="stylesheet" href="../../css/dialog.css">
		<link href="../../js/lib/ligerUI/skins/Aqua/css/ligerui-all.css" rel="stylesheet" type="text/css" />

		<script src="../../js/lib/jquery/jquery-1.10.2.min.js" type="text/javascript"></script>
		<script src="../../js/lib/ligerUI/js/ligerui.all.js" type="text/javascript"></script>

		<script src="../../js/lib/ligerUI/js/plugins/ligerPopupEdit.js"></script>
		<script src="../../js/lib/ligerUI/js/plugins/ligerLayout.js" type="text/javascript"></script>
		<script src="../../js/lib/ligerUI/js/plugins/ligerGrid.js" type="text/javascript"></script>
		<script src="../../js/lib/ligerUI/js/plugins/ligerForm.js" type="text/javascript"></script>
		<script src="../../js/lib/ligerUI/js/plugins/ligerCheckBox.js" type="text/javascript"></script>
		<script src="../../js/lib/ligerUI/js/plugins/ligerComboBox.js" type="text/javascript"></script>
		<script src="../../js/lib/ligerUI/js/plugins/ligerDateEditor.js" type="text/javascript"></script>
		<script src="../../js/lib/ligerUI/js/plugins/ligerRadio.js" type="text/javascript"></script>
		<script src="../../js/lib/ligerUI/js/plugins/ligerTextBox.js" type="text/javascript"></script>
		<script src="../../js/lib/ligerUI/js/plugins/ligerSpinner.js" type="text/javascript"></script>
		<script src="../../js/lib/ligerUI/js/plugins/ligerTree.js" type="text/javascript"></script>
		<script src="../../js/lib/ligerUI/js/plugins/ligerDialog.js" type="text/javascript"></script>
		<script src="../../js/lib/ligerUI/js/plugins/ligerDrag.js" type="text/javascript"></script>
		<script src="../../js/lib/ligerUI/js/plugins/ligerResizable.js" type="text/javascript"></script>
		<script src="../../js/lib/ligerUI/js/plugins/ligerTip.js" type="text/javascript"></script>
		<script src="../../js/lib/ligerUI/js/plugins/ligerMenu.js" type="text/javascript"></script>
		<script src="../../js/lib/ligerUI/js/plugins/ligerToolBar.js" type="text/javascript"></script>
		<script src="../../js/JS/XHD.js" type="text/javascript"></script>
		<script src="../../js/lib/jquery.form.js" type="text/javascript"></script>
		<script src="../../js/lib/json2.js" type="text/javascript"></script>
		<script src="../../js/dialog.js"></script>
		<script src="../../js/constants.js" type="text/javascript"></script>
		<script src="../../js/api.js" type="text/javascript"></script>
		<style>
			a:hover {
				cursor: pointer;
			}
		</style>
		<script type="text/javascript">
			var manager;
			$(document).hover(parent.hindMenu);
			var token = $api.getStorage("token");
			var mid = $api.getparastr("mid");
			var yurl = BaseUrl + "SysOperator?token=" + token;

			$(function() {
				toolbar();
				initView();
			});

			function toolbar() {
				//获取附加权限
				$api.getLimit(mid, 0, function(data) {
					$("#icon-list").append(data);
				});
			}
			
			function doSearch() {
				var key = $("#txtKeywords").val();
				var url = yurl + "&key="+key+"&sid=0"; 
				manager.GetDataByURL(url);
			}

			function initView() {
				var url = yurl + "&key=";

				manager = $("#maingrid4").ligerGrid({
					columns: [{
							display: '创建日期',
							name: 'Fdate2',
							width: 180,
							type: 'date'
							
						}, 
						{
							display: '用户名',
							name: 'Floginname',
							width: 220
						},
						{
							display: '手机号码',
							name: 'Fmobile',
							width: 160
						},
						{
							display: '角色',
							name: 'Frolename',
							width: 110
						},
						{
							display: '状态',
							name: 'Fstatus',
							width: 80,
							render: function(item, rowindex, value) {
								//状态 1-正常 2-冻结
							 	if(item.Fstatus==1)return '正常';
							 	return '冻结';
							}
						},
						{
							display: '描述',
							name: 'Fdecprice',
							width: 220,
							align: 'left'
						},
						{
							display: '最近登录时间',
							name: 'Flastdate2',
							minwidth: 200,
							align: 'left',
							type: 'date' 
						}
					],
					dataAction: 'local',
					method: 'get',
					url: url,
					width: '100%',
					height: '94%',
					usePager: true,
					pageSize: 20,
					onDblClickRow: function(data, rowindex, rowobj) {
						parent.openCommWindow('vsys/sys_operator/Add.html?data=' + escape(JSON.stringify(data)),
							"操作员管理", 600, 480, "User");
					}
				});
			}

			function del() {
				var manager = $("#maingrid4").ligerGetGridManager();
				var row = manager.getSelectedRow();

				if(row) {
					$.ligerDialog.confirm("用户删除后不能恢复，\n您确定要移除？", function(yes) {
						if(yes) {
							var url = yurl + "&action=del";
							$api.ajax2(url, row, function(data) {
								f_reload();
							});
						}
					})
				} else {
					$.ligerDialog.warn("请选择行！");
				}
			}

			function f_reload() {
				manager.loadData(true);
			};
			
//			function add(){
//				parent.openCommWindow('vstore/tb_store_user/Add.html',
//							"店铺用户", 600, 480, "User");
//			}
//
//			function edit() {
//				var manager = $("#maingrid4").ligerGetGridManager();
//				var row = manager.getSelectedRow();
//				if(row) {
//					parent.openCommWindow('vstore/tb_store_user/Add.html?data=' + escape(JSON.stringify(data)),
//						"店铺用户", 600, 480, "User");
//				} else {
//					$.ligerDialog.warn("请选择行");
//				}
//			}

			function saveInfo(row, cmd) {
				if(cmd == "User") {
				 
						var url = yurl + "&action=" + row.action;
						$api.ajax2(url, row.data, function(data) {
							f_reload();
						});
				 
				}
			}
		</script>

	</head>

	<body class="mainbody">
		<form id="form1" onsubmit="return false">
			<div class="toolbar-wrap">
				<div  class="toolbar">
					<div class="l-list">
						<ul id="icon-list" class="icon-list">

						</ul>
					</div>
<div class="r-list">
						<input type="text"  ID="txtKeywords" placeholder='名称/联系方式' class="keyword" />
						<a class='btn-search' onclick='doSearch();' style="margin-right:10px;">搜索</a>

					</div>
				</div>
			</div>

			<div id="maingrid4" style="margin: 0px;background:#fff;"></div>
		</form>

	</body>

</html>